package com.dropdb.demo.service.impl;

import com.dropdb.demo.bean.*;
import com.dropdb.demo.bean.bo.DashboardBO;
import com.dropdb.demo.mapper.*;
import com.dropdb.demo.service.DashboardService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author:tanxin Desc:首页
 * @date:2020/6/26 18:04
 */
@Service
public class DashboardServiceImpl implements DashboardService {
    @Resource
    GoodsMapper goodsMapper;
    @Resource
    OrderMapper orderMapper;
    @Resource
    GoodsProductMapper goodsProductMapper;
    @Resource
    UserMapper userMapper;

    @Override
    public DashboardBO queryCount() {
        Long goodsTotal = goodsMapper.countByExample(new GoodsExample());
        Long orderTotal = orderMapper.countByExample(new OrderExample());
        Long productTotal = goodsProductMapper.countByExample(new GoodsProductExample());
        Long userTotal = userMapper.countByExample(new UserExample());

        return new DashboardBO(goodsTotal,orderTotal,productTotal,userTotal);
    }
}
